package com.punch.system.controller;


import com.punch.common.dto.system.HonorAdviserDTO;
import com.punch.common.model.Result;
import com.punch.common.page.PageInfo;
import com.punch.common.query.syste.HonorAdviserQueryInfo;
import com.punch.common.vo.system.HonorAdviserVO;
import com.punch.system.service.HonorAdviserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 名誉顾问表 前端控制器
 * </p>
 *
 * @author wjj
 * @since 2020-12-14
 */
@RestController
@Api(value = "HonorAdviserController", tags = "名誉顾问管理Controller")
public class HonorAdviserController {


    @Resource
    private HonorAdviserService honorAdviserService;

    /**
     * 名誉顾问列表
     *
     * @param queryInfo 查询条件
     * @return PageInfo<HonorAdviserVO>
     */
    @GetMapping(value = "/honor-advisers", produces = "application/json; charset=utf-8")
    @ApiOperation(value = "名誉顾问列表", notes = "名誉顾问列表", produces = "application/json")
    public Result<PageInfo<HonorAdviserVO>> listHonorAdvise(@ModelAttribute HonorAdviserQueryInfo queryInfo) {
        return Result.succeed(honorAdviserService.listHonorAdvise(queryInfo));
    }


    /**
     * 保存名誉顾问
     *
     * @param honorAdviserDTO 提交表单
     * @return id
     */
    @PostMapping(value = "/honor-adviser", produces = "application/json; charset=utf-8")
    @ApiOperation(value = " 保存名誉顾问", notes = " 保存名誉顾问", produces = "application/json")
    public Result<Integer> saveHonorAdvise(@RequestBody HonorAdviserDTO honorAdviserDTO) {
        return Result.succeed(honorAdviserService.saveHonorAdvise(honorAdviserDTO));
    }

    /**
     * 修改名誉顾问
     *
     * @param honorAdviserDTO 提交表单
     * @return id
     */
    @PutMapping(value = "/honor-adviser", produces = "application/json; charset=utf-8")
    @ApiOperation(value = " 修改名誉顾问", notes = " 修改名誉顾问", produces = "application/json")
    public Result<Integer> updateHonorAdvise(@RequestBody HonorAdviserDTO honorAdviserDTO) {
        return Result.succeed(honorAdviserService.updateHonorAdvise(honorAdviserDTO));
    }


    /**
     * 名誉顾问详情
     *
     * @param honorAdviserId honorAdviserId
     * @return HonorAdviserVO
     */
    @GetMapping(value = "/honor-adviser/{honorAdviserId}", produces = "application/json; charset=utf-8")
    @ApiOperation(value = "名誉顾问详情", notes = "名誉顾问详情", produces = "application/json")
    public Result<HonorAdviserVO> getHonorAdviser(@PathVariable Integer honorAdviserId) {
        return Result.succeed(honorAdviserService.getHonorAdviser(honorAdviserId));
    }

    /**
     * 删除名誉顾问
     *
     * @param honorAdviserId honorAdviserId
     * @return id
     */
    @DeleteMapping(value = "/honor-adviser/{honorAdviserId}", produces = "application/json; charset=utf-8")
    @ApiOperation(value = " 删除名誉顾问", notes = " 删除名誉顾问", produces = "application/json")
    public Result<Integer> deleteHonorAdviser(@PathVariable Integer honorAdviserId) {
        return Result.succeed(honorAdviserService.deleteHonorAdviser(honorAdviserId));
    }


    /**
     * 修改名誉顾问状态
     *
     * @param honorAdviserId honorAdviserId
     * @param status         状态 0-不显示 1-显示
     * @return honorAdviserId
     */
    @PutMapping(value = "/honor-adviser/{honorAdviserId}/status/{status}", produces = "application/json; charset=utf-8")
    @ApiOperation(value = " 修改banner状态", notes = " 修改banner状态", produces = "application/json")
    public Result<Integer> updateHonorAdviserStatus(@PathVariable Integer honorAdviserId, @PathVariable Integer status) {
        return Result.succeed(honorAdviserService.updateHonorAdviserStatus(honorAdviserId, status));
    }
}
